#!/bin/bash


regirestry="swr.cn-central-221.ovaijisuan.com/ee"
cat all-third-images|grep -v "#"| while read line;do
    ee1=$(echo $line | cut -d "/" -f 1)
    ee2=$(echo $line | cut -d "/" -f 2)
    ee3=$(echo $line | cut -d "/" -f 3)
    docker pull $line
    if [ -z "$ee3" ];then
      echo "docker tag $ee1/$ee2 $regirestry/$ee1"_"$ee2"
      docker tag $ee1/$ee2 $regirestry/$ee1"_"$ee2
      docker push $regirestry/$ee1"_"$ee2
    else
      echo "docker tag "$ee1/$ee2/$ee3" $regirestry/$ee1"_"$ee2"_"$ee3"
      docker tag "$ee1/$ee2/$ee3" $regirestry/$ee1"_"$ee2"_"$ee3
      docker push $regirestry/$ee1"_"$ee2"_"$ee3
    fi
done